package com.example.springblog.service;

import com.example.springblog.mapper.BlogInfoMapper;
import com.example.springblog.moder.Blog;
import com.example.springblog.moder.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    private BlogInfoMapper blogInfoMapper;

    public List<Blog> getList(){
        return blogInfoMapper.getBlogs();
    }

    public Blog getBlogDetail(Integer blogId){
        return blogInfoMapper.getBlogDetail(blogId);
    }

    public boolean updata(Blog blog) {
        return blogInfoMapper.update(blog);
    }

    public boolean insert(Blog blog) {
        int n = blogInfoMapper.insert(blog);
        if (n == 1){
            return true;
        }
        return false;
    }
}
